package com.ppt.javappt.pojo;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        include = JsonTypeInfo.As.PROPERTY,
        property = "type"
)
// 具体子类
@JsonSubTypes({
        @JsonSubTypes.Type(value = RectData.class, name = "Rect"),
        @JsonSubTypes.Type(value = TextBoxData.class, name = "Text")
})
@Data
public class NodeData {
    protected double x,y,width,height;
    protected String type = "";
}

class RectData extends NodeData{
    RectData(){
        type = "Rect";
    }
}
@Getter
@Setter
class TextBoxData extends NodeData{
    TextBoxData(){
        type = "Text";
    }
    private String fontFamily;
    private boolean isBold = false;
    private boolean isItalic = false;
    private int fontSize;
    private String text;
    private String style;
}